<template>
    <ul class="bar">
        <li @click="onclick(index)" v-for="(item,index) in list">{{item.text}}
            <span class="line"  v-if="cindex==index" ></span>
        </li>
    </ul>
</template>

<script>
  export default {
    name: 'set-left-nav',
    data:function() {
      return {
        cindex:1,
        list: [
          { text: '信息设置' },
          { text: '个人信息' },
          { text: '企业信息' },
          { text: '账号设置' },
          { text: '账号绑定' },
          { text: '修改密码' }
        ]
      }
    },methods:{
      onclick:function(index){
        if(index==0||index==3) return;
        this.cindex = index;
        if(index==4){
          this.$router.push({path:"/setting/binding"});
        }else if(index==5){
          this.$router.push({path:"/setting/password"});
        }
        console.log(index);
      }
    }
  }
</script>

<style scoped>
    .bar {
        width: 202px;
        height: 242px;
        border-radius: 3px;
        border-top: solid red 3px;
    }
    .bar .line{
        position: absolute;
        left: 0px;
        width: 3px;
        height: 32px;
        background:rgba(255,115,0,1);
    }
    .bar li {
        height: 40px;
        width: 100%;
        padding-left: 28px;
        line-height: 40px;
        background-color: white;
        font-size: 14px;
        font-weight: 400;
    }

    .bar li:nth-child(1), .bar li:nth-child(4) {
        background-color: rgba(242, 242, 242, 1);
        font-size: 16px;
        font-weight: 500;
    }
    .bar .line{
        width: 3px;
        height: 32px;
        border:1px solid rgba(230,230,235,1);
    }

</style>